package IO.g2;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Arrays;

public class FileTest implements FilenameFilter{

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		char sep = File.pathSeparatorChar;
		String seperator = File.separator;
		
		File absoluteDirectory = new File(sep+"Hallo"+sep);
		System.out.println(absoluteDirectory);
		
		File relativeFile = new File("Hallo/Ihr");
		System.out.println(relativeFile.getAbsolutePath());
		
		File relativeDirectory = new File(".");
		
		System.out.println(File.createTempFile("bla", ".txt").getAbsolutePath());
		
		System.out.println(relativeDirectory.getCanonicalPath());
		
		File[] entries = new File(".").listFiles(new FileTest());
		//System.out.println(Arrays.toString(entries));

		boolean status = new File("/tmp/").mkdir();
		System.out.println(status);
		status = new File("/tmp1/nocheiner/").mkdirs();
		System.out.println(status);

	}

	@Override
	public boolean accept(File dir, String name) {
		return new File(dir,name).isFile() &&
				name.toLowerCase().endsWith(".txt");
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}

}
